package com.dm0858.bianmin.ui.presenter;

import com.dm0858.bianmin.model.response.MemberResponse;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.view.IMemberView;
import com.socks.library.KLog;

import rx.Subscriber;

/**
 * Created by yelvqing on 2018/1/22.
 */

public class MemberPresenter  extends BasePresenter<IMemberView> {

    public MemberPresenter(IMemberView view) {
        super(view);
    }

    public void postRegister(String account,String pwd) {
        addSubscription(mApiService.postRegister(account,pwd), new Subscriber<MemberResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

                e.printStackTrace();
                KLog.e(e.getLocalizedMessage());
                mView.onError();
            }

            @Override
            public void onNext(MemberResponse response) {

                mView.onGetMemberSuccess(response);
            }

        });
    }
}
